package com.edu.d3_collection_traversal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;

public class Demo {
    public static void main(String[] args) {
        Collection<Movie> list = new ArrayList<>();
        list.add(new Movie("战狼",6987,"奥特曼"));
        list.add(new Movie("战狼2",0.222,"迪迦"));
        list.add(new Movie("战狼2",999.22,"泰罗"));
        System.out.println(list);
        list.forEach(movie->{
                System.out.println(movie.getName());
                System.out.println(movie.getPrice());
                System.out.println(movie.getActore());
                System.out.println("-------------");
            }
        );
        list.forEach(new Consumer<Movie>() {
            @Override
            public void accept(Movie movie) {
                System.out.println(movie.getName());
                System.out.println(movie.getPrice());
                System.out.println(movie.getActore());
                System.out.println("-------------");
            }
        });
        for (Movie movie : list) {
        System.out.println(movie.getName());
        System.out.println(movie.getPrice());
        System.out.println(movie.getActore());
        System.out.println("-------------");
    }
}
}
